from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from app.config.config import config
from app.settings import env

def db_connect():
      config_class = config[env]()
      engine = create_engine(config_class.db_url,echo = config_class.if_echo)
      session = sessionmaker(engine)
      db_session = scoped_session(session)
      Base = declarative_base()
      return db_session,Base,engine
